package com.ctrip.cap.device.ios.impl;

import java.io.File;

import com.ctrip.cap.device.ios.IOSApp;
import com.ctrip.cap.device.model.AppInfo;

public class DefaultIOSApp implements IOSApp {
	private File appFile;
	private String bundleId;
	private String versionName;

	public DefaultIOSApp(File app) {
		appFile = app;
	}

	@Override
	public String getAbsolutePath() {
		return appFile.getAbsolutePath();
	}

	@Override
	public String getBundleId() {
		return bundleId;
	}

	@Override
	public void setBundleId(String bundleId) {
		this.bundleId = bundleId;
	}

	@Override
	public String getVersionName() {
		return versionName;
	}

	@Override
	public void setVersionName(String versionName) {
		this.versionName = versionName;
	}

	public AppInfo toAppInfo() {
		AppInfo appInfo = new AppInfo();
		appInfo.setMainActivity(this.getBundleId());
		appInfo.setPackageURI(this.getAbsolutePath());
		appInfo.setBasePackage("");
		appInfo.setVersion(this.getVersionName());
		return appInfo;
	}

}
